package com.baiyu.scerp.customer.service.impl;

import java.util.List;
import com.baiyu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baiyu.scerp.customer.mapper.ScCustomerMapper;
import com.baiyu.scerp.customer.domain.ScCustomer;
import com.baiyu.scerp.customer.service.IScCustomerService;
import com.baiyu.common.core.text.Convert;

/**
 * 客户信息Service业务层处理
 * 
 * @author wph
 * @date 2025-08-15
 */
@Service
public class ScCustomerServiceImpl implements IScCustomerService 
{
    @Autowired
    private ScCustomerMapper scCustomerMapper;

    /**
     * 查询客户信息
     * 
     * @param customerId 客户信息主键
     * @return 客户信息
     */
    @Override
    public ScCustomer selectScCustomerByCustomerId(Long customerId)
    {
        return scCustomerMapper.selectScCustomerByCustomerId(customerId);
    }

    /**
     * 查询客户信息列表
     * 
     * @param scCustomer 客户信息
     * @return 客户信息
     */
    @Override
    public List<ScCustomer> selectScCustomerList(ScCustomer scCustomer)
    {
        return scCustomerMapper.selectScCustomerList(scCustomer);
    }

    /**
     * 新增客户信息
     * 
     * @param scCustomer 客户信息
     * @return 结果
     */
    @Override
    public int insertScCustomer(ScCustomer scCustomer)
    {
        scCustomer.setCreateTime(DateUtils.getNowDate());
        return scCustomerMapper.insertScCustomer(scCustomer);
    }

    /**
     * 修改客户信息
     * 
     * @param scCustomer 客户信息
     * @return 结果
     */
    @Override
    public int updateScCustomer(ScCustomer scCustomer)
    {
        scCustomer.setUpdateTime(DateUtils.getNowDate());
        return scCustomerMapper.updateScCustomer(scCustomer);
    }

    /**
     * 批量删除客户信息
     * 
     * @param customerIds 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteScCustomerByCustomerIds(String customerIds)
    {
        return scCustomerMapper.deleteScCustomerByCustomerIds(Convert.toStrArray(customerIds));
    }

    /**
     * 删除客户信息信息
     * 
     * @param customerId 客户信息主键
     * @return 结果
     */
    @Override
    public int deleteScCustomerByCustomerId(Long customerId)
    {
        return scCustomerMapper.deleteScCustomerByCustomerId(customerId);
    }
}
